package com.class_;

/*获取某个类的成员变量的结构信息*/

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Demo {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchFieldException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        // 获取Class对象
        Class<Person> cls = Person.class;
        Method method = cls.getMethod("show");
        System.out.println(method.getModifiers());
    }
}

class Person {
    private String name = "zhangsan";
    private int age = 10;

    public Person() {
    }

    private Person(int age) {
        this.age = age;
    }

    public static void show() {
        System.out.println("hi");
    }
}